package com.morehair.exceptionHandler;


import com.morehair.bean.vo.admin.BaseRespVo;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authz.AuthorizationException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Author  kkw
 * Date  2021/6/7 23:49
 * Version 1.0
 * Description :
 */
@ControllerAdvice
public class AuthException {
    @ExceptionHandler(AuthorizationException.class)
    @ResponseBody
    public BaseRespVo handlerAuthorizationException(Exception e){
        return BaseRespVo.fail(506,null,"你个垃圾,没有权限进行此操作");
    }
    @ExceptionHandler(AuthenticationException.class)
    @ResponseBody
    public BaseRespVo handlerAuthenticationException(Exception e){
        return BaseRespVo.fail(506,null,"你个垃圾,滚去登录");
    }
}
